﻿using AutoMapper;
using BlogDemo.Application.PostApp.Resource;
using BlogDemo.Core.Domain;
using System;
using System.Collections.Generic;
using System.Text;

namespace BlogDemo.Application.PostApp.Profiles
{
    public class PostProfile : Profile
    {
        public PostProfile()
        {
            CreateMap<Post, PostAddResourceModel>()
                                              // .ForMember(dest => dest.CreatDate, opt => opt.MapFrom(x => x.CreateAt))
                //.ForSourceMember(src => src.CreateAt, opt => opt.DoNotValidate())
                //.ForSourceMember(src => src.Id, opt => opt.DoNotValidate())
                //.ForSourceMember(src => src.Tags, opt => opt.DoNotValidate())
                ;
            //CreateMap<Source, Dest>()
            CreateMap<PostAddResourceModel, Post>()
                                .ForMember(dest => dest.CreateAt, opt => opt.Ignore())
                                .ForMember(dest => dest.Id, opt => opt.Ignore())
                                .ForMember(dest => dest.PostTags, opt => opt.Ignore())
                                .ForMember(dest => dest.Blog, opt => opt.Ignore());

                ;
        }
    }
}
